package hcn.protocol.brandnew.dengji.guahao;

import com.fasterxml.jackson.annotation.JsonFormat;
import ctd.util.xml.jaxb.DateAdapter;
import ctd.util.xml.jaxb.DateTimeAdapter;
import hcn.protocol.brandnew.BaseRequest;
import lombok.Data;
import org.atag.sysrouter.annotation.DictionaryMapping;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.Date;


/**
 * 门诊挂号信息更新服务-请求消息 - ODS_02030002
 *
 * @author enjoyLife
 */
@Data
@XmlRootElement(name = "MsgBody")
@XmlAccessorType(XmlAccessType.FIELD)
public class ReturnVisitPaymentCancelRequest extends BaseRequest {

    /**
     * 患者基本信息
     */
    @XmlElement(name = "Patient")
    private Patient patient;
    /**
     * 门（急）诊挂号记录
     */
    @XmlElement(name = "OptRegister")
    private OptRegister optRegister;

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Patient {
        @XmlElement(name = "Age")
        private String age;

        /**
         * 业务系统患者档案ID
         */
        @XmlElement(name = "SourcePatientId")
        private String sourcePatientId;
        /**
         * 业务系统患者档案类型
         */
        @XmlElement(name = "SourcePatientIdType")
        private String sourcePatientIdType;
        /**
         * 建档机构代码
         */
        @XmlElement(name = "AuthorOrganization")
        private String authorOrganization;
        /**
         * 身份证件号码
         */
        @XmlElement(name = "IdCard")
        private String idCard;
        /**
         * 身份证件类别代码
         */
        @XmlElement(name = "IdCardCode")
        private String idCardCode;
        /**
         * 患者姓名
         */
        @XmlElement(name = "Name")
        private String name;
        /**
         * 性别代码
         */
        @XmlElement(name = "Sex")
        private String sex;
        /**
         * 出生日期
         */
        @XmlElement(name = "BirthDate")
        @XmlJavaTypeAdapter(DateAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
        private Date birthDate;
        /**
         * 电话号码
         */
        @XmlElement(name = "PatientPhone")
        private String patientPhone;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class OptRegister {
        @XmlElement(name = "MedicalCostPayTypeCode")
        private String medicalCostPayTypeCode;
        @XmlElement(name = "AppointsRoute")
        private String appointsRoute;
        @XmlElement(name = "VisitOrganizationName")
        private String visitOrganizationName;
        @XmlElement(name = "BookCost")
        private String bookCost;
        @XmlElement(name = "CardCost")
        private String cardCost;
        @XmlElement(name = "DepartmentLoca")
        private String departmentLoca;
        @XmlElement(name = "DoctorCost")
        private String doctorCost;
        @XmlElement(name = "DoctorMajorType")
        private String doctorMajorType;
        @XmlElement(name = "ExaminationCost")
        private String examinationCost;
        @XmlElement(name = "IsAppoints")
        private String isAppoints;

        /**
         * 预约记录流水号
         */
        @XmlElement(name = "AppointsId")
        private String appointsId;
        /**
         * 挂号流水号
         */
        @XmlElement(name = "OutRegistryId")
        private String outRegistryId;
        /**
         * 患者类型代码
         */
        @XmlElement(name = "PatientType")
        private String patientType;
        /**
         * 门（急）诊号
         */
        @XmlElement(name = "ClinicId")
        private String clinicId;
        /**
         * 就诊次数
         */
        @XmlElement(name = "VisitTimes")
        private Short visitTimes;
        /**
         * 就诊卡类别代码
         */
        @XmlElement(name = "MedicalCardType")
        private String medicalCardType;
        /**
         * 就诊卡号
         */
        @XmlElement(name = "MedicalCardId")
        private String medicalCardId;
        /**
         * 挂号机构代码
         */
        @XmlElement(name = "VisitOrganization")
        private String visitOrganization;
        /**
         * 挂号科室代码
         */
        @XmlElement(name = "RegisteredDept")
        private String registeredDept;
        /**
         * 挂号医师代码
         */
        @XmlElement(name = "RegisteredDcotor")
        private String registeredDcotor;
        /**
         * 挂号日期时间
         */
        @XmlElement(name = "RegisteredDateTime")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date registeredDateTime;
        /**
         * 挂号类别代码
         */
        @XmlElement(name = "RegisteredType")
        private String registeredType;
        /**
         * 医师排班类别代码
         */
        @DictionaryMapping("hcn.base.dictionary.HCN_outpatientSchedulingService")
        @XmlElement(name = "DoctorDutyType")
        private String doctorDutyType;
        /**
         * 就诊原因
         */
        @XmlElement(name = "ClinicCause")
        private String clinicCause;
        /**
         * 医疗保险类别代码
         */
        @XmlElement(name = "MedicalInsuranceCategoryCode")
        private String medicalInsuranceCategoryCode;
        /**
         * 医疗保险类别名称
         */
        @XmlElement(name = "MedicalInsuranceName")
        private String medicalInsuranceName;
        /**
         * 分时段开始时间
         */
        @XmlElement(name = "DaypartingBeginDateTime")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date daypartingBeginDateTime;
        /**
         * 分时段结束时间
         */
        @XmlElement(name = "DaypartingEndDateTime")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date daypartingEndDateTime;
        /**
         * 排班日期时间
         */
        @XmlElement(name = "ScheduleDateTime")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date scheduleDateTime;
        /**
         * 挂号状态
         */
        @XmlElement(name = "OperationType")
        private String operationType;
        /**
         * 操作人
         */
        @XmlElement(name = "Operator")
        private String operator;
        /**
         * 操作时间
         */
        @XmlElement(name = "OperateDateTime")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date operateDateTime;
    }

}
